package com.vmj.test.example;

/**
 * Created by yangshoujun on 2017/8/26 下午11:30.
 */
public class MyObject implements Cloneable {

    public static  int staticVar = 1000;
    public int instanceVar = 2000000;

//    static {
//        staticVar = 10;
//    }
//
//    static {
//        int x = 20;
//    }

    public MyObject() {
    }

    public MyObject(int var) {
        instanceVar = var;
    }

    public MyObject(int var1, int var2) {
        instanceVar = var1;
    }

    public static void main(String[] args) {
        System.out.println(staticVar);
//        int x = 32768;
//        MyObject myObject = new MyObject(100);
//        System.out.println(myObject.instanceVar);
//        myObject.staticVar = x;
//        x = MyObject.staticVar;
//        System.out.println(x);
//        myObject.instanceVar=x;
//        x=myObject.instanceVar;
//        System.out.println(x);
//
//        OtherObject o = new OtherObject();
//        o.var = 1;
//        System.out.println(1);
//        System.out.println(2);
//
//        int x1 = 1024;
//        int x2 = 2048;
//        System.out.println(myObject.sum(x1, x2));

    }

    private int sum(int x1, int x2) {
        int r =  x1 + x2;
        int c = 1;
        return c;
    }

    public Object clone() {
        try {
            return super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return null;
    }
}